package com.dhsc.service.impl.ywjk.cgyhjh;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dhsc.domain.jkzx.ywjk.cgyhjh.DqycmxVo;
import com.dhsc.domain.yypt.LayuiTableVo;
import com.dhsc.exception.MyException;
import com.dhsc.local.dao.ywjk.cgyhjh.IDqycmxDao;
import com.dhsc.service.ywjk.cgyhjh.IDqycmxService;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.page.PageMethod;

import lombok.extern.slf4j.Slf4j;

/**
 * @ClassName: DqycmxServiceImpl
 * @Description: 当前异常明细
 * @Author: jwj
 * @Date: 2023/11/7 11:06
 */
@Service
@Slf4j
public class DqycmxServiceImpl implements IDqycmxService {

    @Autowired
    private IDqycmxDao dqycmxDao;

    @Override
    public LayuiTableVo queryDqycmx(DqycmxVo dqycmxVo) {
        LayuiTableVo obj = new LayuiTableVo();
        try{
            PageMethod.startPage(dqycmxVo.getPage(), dqycmxVo.getLimit());
            List<DqycmxVo> list = dqycmxDao.queryDqycmx(dqycmxVo);
            PageInfo<DqycmxVo> pageInfo = new PageInfo<>(list);
            obj.setData(list);
            obj.setMsg("");
            obj.setCount(pageInfo.getTotal());
            obj.setCode(0);
        }catch(Exception e){
            log.error("当前异常明细查询出错", e);
            throw new MyException("当前异常明细查询出错",e);
        }
        return obj;
    }

}
